#include "colordialog.h"
#include <QColorDialog>

ColorDialog::ColorDialog(QWidget *parent)
    : QDialog(parent)
{
    colorBtn = new QPushButton(tr("Color"));
    colorFrame = new QFrame();
    //????
    colorFrame->setFrameShape(QFrame::Box);
    colorFrame->setAutoFillBackground(true);

    mainLayout = new QGridLayout(this);
    mainLayout->addWidget(colorBtn, 0, 0);
    mainLayout->addWidget(colorFrame, 0, 1);

    connect(colorBtn, SIGNAL(clicked()), this, SLOT(showColor()));
}

ColorDialog::~ColorDialog()
{

}

void ColorDialog::showColor()
{
    QColor color = QColorDialog::getColor(Qt::blue);
    if(color.isValid())
        colorFrame->setPalette(QPalette(color));
}
